﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript读取自身文件内的XML</title>
    <script type="text/javascript" language="JavaScript">
        window.onload = function (){
            alert(xml1.XMLDocument.documentElement.xml);    // 使用XMLDOM对象获取xml内容
        }

    </script>
</head>

<xml id="xml1">
    <?xml version="1.0"?>
    <myxml>
        <root>
            <son1>aaaa</son1>
            <son2>bbbb</son2>
        </root>
        <root>
            <son1>cccc</son1>
            <son2>dddd</son2>
        </root>
    </myxml>
</xml>

<body>

</body>
</html>